/**
 * Copyright(c) TacoTag/Fukila organization 
 * FileName: ResourceExtension.java.
 * Created by Lance on 2009/4/22 
 * Change History 
 * Date Flag Owner Change Comment
 */
package org.fukila.core.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * Purpose:
 * 
 * @author Lance
 * @date 2009/4/22
 */
@Entity
@Table(name = "ResExtension")
public class ResourceExtension {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String extId;
    private String className;
    private String classId;
    private String attributes;
    private Date   modifyDate;

    public ResourceExtension(String extId, String className, String classId) {
        super();
        this.extId = extId;
        this.className = className;
        this.classId = classId;
    }

    public ResourceExtension() {
        super();
        // TODO Auto-generated constructor stub
    }


    public String getExtId() {
        return this.extId;
    }

    public void setExtId(String extId) {
        this.extId = extId;
    }

    public String getClassName() {
        return this.className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getClassId() {
        return this.classId;
    }

    public void setClassId(String classId) {
        this.classId = classId;
    }

    public String getAttributes() {
        return this.attributes;
    }

    public void setAttributes(String attributes) {
        this.attributes = attributes;
    }

    public Date getModifyDate() {
        return this.modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }
    

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((this.attributes == null) ? 0 : this.attributes.hashCode());
        result = prime * result + ((this.classId == null) ? 0 : this.classId.hashCode());
        result = prime * result + ((this.className == null) ? 0 : this.className.hashCode());
        result = prime * result + ((this.extId == null) ? 0 : this.extId.hashCode());
        result = prime * result + ((this.modifyDate == null) ? 0 : this.modifyDate.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( getClass() != obj.getClass() )
            return false;
        ResourceExtension other = (ResourceExtension) obj;
        if ( this.attributes == null ) {
            if ( other.attributes != null )
                return false;
        } else if ( !this.attributes.equals(other.attributes) )
            return false;
        if ( this.classId == null ) {
            if ( other.classId != null )
                return false;
        } else if ( !this.classId.equals(other.classId) )
            return false;
        if ( this.className == null ) {
            if ( other.className != null )
                return false;
        } else if ( !this.className.equals(other.className) )
            return false;
        if ( this.extId == null ) {
            if ( other.extId != null )
                return false;
        } else if ( !this.extId.equals(other.extId) )
            return false;
        if ( this.modifyDate == null ) {
            if ( other.modifyDate != null )
                return false;
        } else if ( !this.modifyDate.equals(other.modifyDate) )
            return false;
        return true;
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this).append("classId", this.classId).append("className", this.className).append(
                "modifyDate", this.modifyDate).append("extId", this.extId).append("attributes", this.attributes)
                .toString();
    }    
}
